package com.shangxia.monomer.common.log.controller;

import com.alibaba.fastjson.JSONObject;
import com.shangxia.monomer.common.log.service.LogService;
import com.shangxia.monomer.common.log.vo.LogVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhouya38158
 * @Package com.shangxia.monomer.common.log
 * @date 2021/7/29 10:58
 */
@Api(tags = "日志")
@RestController
@RequestMapping("/log")
public class LogController {
    @Autowired
    private LogService logService;

    @ApiOperation("创建日志")
    @PostMapping("/log")
    public LogVO create(@RequestBody LogVO logVO) {
        System.out.println(JSONObject.toJSONString(logVO));
        return logVO;
    }

    @ApiOperation("查询日志byId")
    @GetMapping("/log/{id}")
    public LogVO getLogVOById(@PathVariable String id) {
        LogVO logVO = logService.getLogVOById(id);
        return logVO;
    }

    @ApiOperation("查询日志")
    @PostMapping("/logs")
    public List<LogVO> query(@RequestBody LogVO logVO) {
        System.out.println(JSONObject.toJSONString(logVO));
        return new ArrayList<>();
    }

}
